package com.jx.lcs.productorder.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jx.lcs.productorder.entity.ProductOrder;
import com.jx.lcs.productorder.service.ProductOrderService;
import com.tianyu.jty.common.persistence.Page;
import com.tianyu.jty.common.web.BaseController;

/** 
 * 产品预约
 * @author JiaYY 
 * @date 2015年8月14日
 */
@Controller
@RequestMapping("productOrder")
public class ProductOrderController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(ProductOrderController.class);
	
	@Autowired
	private ProductOrderService productOrderService;
	
	/**
	 * 默认页面
	 */
	@RequestMapping(method = RequestMethod.GET)
	public String list() {
		return "productorder/productOrderList";
	}
	
	/**
	 * 获取产品预约列表json
	 */
	@RequestMapping(value="json",method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> productOrderList(HttpServletRequest request) {
		try{
			Page<ProductOrder> page = getPage(request);
			page = productOrderService.findProductOrderList(page, request);
			return getEasyUIData(page);
		}catch(Exception e){
			logger.info("--获取产品预约列表出现异常！", e);
			return null;
		}
	}
}
